import { IPSAppDELogic } from '../../app/dataentity/ipsapp-delogic';
import { IPSAppDataEntity } from '../../app/dataentity/ipsapp-data-entity';
import { IPSDataEntity } from '../ipsdata-entity';
import { IPSDEDELogicLogic } from './ipsdedelogic-logic';
import { IPSDELogic } from './ipsdelogic';
import { IPSDELogicParam } from './ipsdelogic-param';
import { PSDELogicNodeImpl } from './psdelogic-node-impl';

export class PSDEDELogicLogicImpl extends PSDELogicNodeImpl implements IPSDEDELogicLogic {
  protected dstpsappdelogic: IPSAppDELogic | null = null;

  getDstPSAppDELogic(): IPSAppDELogic | null {
    if (this.dstpsappdelogic != null) return this.dstpsappdelogic;
    const value = this.M.getDstPSAppDELogic;
    if (value == null) {
      return null;
    }
    this.dstpsappdelogic = this.getDstPSAppDataEntityMust().findPSAppDELogic(value);
    return this.dstpsappdelogic;
  }

  get dstPSAppDELogic(): IPSAppDELogic | null {
    return this.getDstPSAppDELogic();
  }

  getDstPSAppDELogicMust(): IPSAppDELogic {
    const value = this.getDstPSAppDELogic();
    if (value == null) {
      throw new Error('未指定应用实体逻辑对象');
    }
    return value;
  }

  protected dstpsappdataentity: IPSAppDataEntity | null = null;

  getDstPSAppDataEntity(): IPSAppDataEntity | null {
    if (this.dstpsappdataentity != null) return this.dstpsappdataentity;
    const value = this.M.getDstPSAppDataEntity;
    if (value == null) {
      return null;
    }
    this.dstpsappdataentity = this.getPSModel4('app.dataentity.IPSAppDataEntity', value, 'getDstPSAppDataEntity') as IPSAppDataEntity;
    return this.dstpsappdataentity;
  }

  get dstPSAppDataEntity(): IPSAppDataEntity | null {
    return this.getDstPSAppDataEntity();
  }

  getDstPSAppDataEntityMust(): IPSAppDataEntity {
    const value = this.getDstPSAppDataEntity();
    if (value == null) {
      throw new Error('未指定应用实体对象');
    }
    return value;
  }

  protected dstpsdelogic: IPSDELogic | null = null;

  getDstPSDELogic(): IPSDELogic | null {
    if (this.dstpsdelogic != null) return this.dstpsdelogic;
    const value = this.M.getDstPSDELogic;
    if (value == null) {
      return null;
    }
    this.dstpsdelogic = this.getDstPSDataEntityMust().findPSDELogic(value);
    return this.dstpsdelogic;
  }

  get dstPSDELogic(): IPSDELogic | null {
    return this.getDstPSDELogic();
  }

  getDstPSDELogicMust(): IPSDELogic {
    const value = this.getDstPSDELogic();
    if (value == null) {
      throw new Error('未指定目标实体逻辑对象');
    }
    return value;
  }

  protected dstpsdelogicparam: IPSDELogicParam | null = null;

  getDstPSDELogicParam(): IPSDELogicParam | null {
    if (this.dstpsdelogicparam != null) return this.dstpsdelogicparam;
    const value = this.M.getDstPSDELogicParam;
    if (value == null) {
      return null;
    }
    const ipsdelogic = this.getParentPSModelObject('dataentity.logic.IPSDELogic') as IPSDELogic;
    if (ipsdelogic != null) {
      this.dstpsdelogicparam = ipsdelogic.findPSDELogicParam(value);
    }
    return this.dstpsdelogicparam;
  }

  get dstPSDELogicParam(): IPSDELogicParam | null {
    return this.getDstPSDELogicParam();
  }

  getDstPSDELogicParamMust(): IPSDELogicParam {
    const value = this.getDstPSDELogicParam();
    if (value == null) {
      throw new Error('未指定目标逻辑参数对象');
    }
    return value;
  }

  protected dstpsdataentity: IPSDataEntity | null = null;

  getDstPSDataEntity(): IPSDataEntity | null {
    if (this.dstpsdataentity != null) return this.dstpsdataentity;
    const value = this.M.getDstPSDataEntity;
    if (value == null) {
      return null;
    }
    this.dstpsdataentity = this.getPSModel4('dataentity.IPSDataEntity', value, 'getDstPSDataEntity') as IPSDataEntity;
    return this.dstpsdataentity;
  }

  get dstPSDataEntity(): IPSDataEntity | null {
    return this.getDstPSDataEntity();
  }

  getDstPSDataEntityMust(): IPSDataEntity {
    const value = this.getDstPSDataEntity();
    if (value == null) {
      throw new Error('未指定目标实体对象');
    }
    return value;
  }

  protected retpsdelogicparam: IPSDELogicParam | null = null;

  getRetPSDELogicParam(): IPSDELogicParam | null {
    if (this.retpsdelogicparam != null) return this.retpsdelogicparam;
    const value = this.M.getRetPSDELogicParam;
    if (value == null) {
      return null;
    }
    const ipsdelogic = this.getParentPSModelObject('dataentity.logic.IPSDELogic') as IPSDELogic;
    if (ipsdelogic != null) {
      this.retpsdelogicparam = ipsdelogic.findPSDELogicParam(value);
    }
    return this.retpsdelogicparam;
  }

  get retPSDELogicParam(): IPSDELogicParam | null {
    return this.getRetPSDELogicParam();
  }

  getRetPSDELogicParamMust(): IPSDELogicParam {
    const value = this.getRetPSDELogicParam();
    if (value == null) {
      throw new Error('未指定返回值绑定逻辑参数对象');
    }
    return value;
  }

  get cls(): string {
    return 'PSDEDELogicLogicImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'dataentity.logic.IPSDEDELogicLogic') return true;
    return super.instanceof(cls);
  }
}
